package cn.wolfcode.wolf2w.common.sms.config;

import cn.wolfcode.wolf2w.common.sms.service.impl.AliyunSmsServiceImpl;
import cn.wolfcode.wolf2w.common.sms.service.impl.TencentSmsServiceImpl;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Conditional;
import org.springframework.context.annotation.Configuration;

@Configuration
@ConditionalOnProperty(prefix = "tencent.sms",name = {"templateId","signName","smsSdkAppId","secretKey","secretId"})
public class SmsAutoConfiguration {
    @Bean
    @ConfigurationProperties(prefix = "tencent.sms")
    public SmsProperties smsProperties(){
        return new SmsProperties();
    }

    @Bean
    public TencentSmsServiceImpl tencentSmsService(){
        return new TencentSmsServiceImpl();
    }
}
